#include "DL_PD.h"
#include "My_PARAM.h"
#include "Data_Buffer.h"
#include "DL_MH.h"
#include <string.h>
#include "DL_Service.h"

PD_STATE_TYPE PD_STATE;

 

//test git
void Init_PD(void){
   PD_STATE=PD_Inactive_0;
}

//转移动作
void DL_PD_T1(void){
	 //待更新
}


void DL_PD_T3(void);

void DL_PD_T4(void);

//驱动事件
void Event_PD_Conf_ACTIVE(void){
    if(PD_STATE==PD_Inactive_0){
        PD_STATE=PD_PDActive_1;
        //DL_PD_T2();
    }
}

void Event_PD_Conf_INACTIVE(void){
    if(PD_STATE==PD_PDActive_1){
        PD_STATE=PD_Inactive_0;
        
    }
}

void Event_DL_PDInputUpdate(void){
    if(PD_STATE==PD_PDActive_1){
        DL_PD_T3();
    }
}

void Event_PD_ind(void){
    if(PD_STATE==PD_PDActive_1){
         
        DL_PD_T4();
    }
    if(PD_STATE==PD_Inactive_0){
         DL_PD_T1();
    }
}


void DL_PD_T3(void){
   //使用传感器的值填充 PDDataIn数组
}

void DL_PD_T4(void){
    //这里PD In out的方向是相对于主站来讲
    if(MC_STRUCT.PDint_Len!=0){
        memcpy(MC_STRUCT.PDin,PDDataIn,MC_STRUCT.PDint_Len);
    }
    if(MC_STRUCT.PDout_Len!=0){
        memcpy(PDDataOut,MC_STRUCT.PDout,MC_STRUCT.PDout_Len);
        Service_DL_PDOutputTransport_ind();
    } 
    Service_DL_PDCycle_ind();
   
}

 